package com.iplant.aps.service.mesenum;

import com.iplant.aps.service.po.cfg.CFGItem;

import java.util.ArrayList;
import java.util.List;

/**
 * 线边库使用明细推送状态
 *
 * @author YouWang·Peng
 *  2023-11-20 09:51:38
 */
public enum WMSPickDemandItemIsPostType {
    /**
     * 暂未推送
     */
    Default(0, "暂未推送"),
    /**
     * 成功
     */
    Success(1, "成功"),
    /**
     * 待分拣
     */
    Fail(2, "失败"),
    /**
     * 预留过账
     */
    ReservedPosting(3, "预留过账");

    private final int value;
    private final String lable;

    WMSPickDemandItemIsPostType(int value, String lable) {
        this.value = value;
        this.lable = lable;
    }

    /**
     * 通过 value 的数值获取枚举实例
     */
    public static WMSPickDemandItemIsPostType getEnumType(int val) {
        for (WMSPickDemandItemIsPostType type : WMSPickDemandItemIsPostType.values()) {
            if (type.getValue() == val) {
                return type;
            }
        }
        return WMSPickDemandItemIsPostType.Default;
    }

    public static List<CFGItem> getEnumList() {
        List<CFGItem> wItemList = new ArrayList<CFGItem>();

        for (WMSPickDemandItemIsPostType type : WMSPickDemandItemIsPostType.values()) {
            CFGItem wItem = new CFGItem();
            wItem.ID = type.getValue();
            wItem.ItemName = type.getLable();
            wItem.ItemText = type.getLable();
            wItemList.add(wItem);
        }
        return wItemList;
    }

    public int getValue() {
        return value;
    }

    public String getLable() {
        return lable;
    }
}
